package com.soccernews.main;

import java.util.ArrayList;
import java.util.List;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MessageViewAdaptor extends BaseAdapter {
 private static List<Message> itemDetailsrrayList;
 
 
 
 private LayoutInflater l_Inflater;

 public MessageViewAdaptor(Context context, List<Message> results) {
  itemDetailsrrayList = results;
  l_Inflater = LayoutInflater.from(context);
 }

 public int getCount() {
  return itemDetailsrrayList.size();
 }

 public Object getItem(int position) {
  return itemDetailsrrayList.get(position);
 }

 public long getItemId(int position) {
  return position;
 }

 public View getView(int position, View convertView, ViewGroup parent) {
  ViewHolder holder;
  if (convertView == null) {
   convertView = l_Inflater.inflate(R.layout.listviewlo, null);
   holder = new ViewHolder();
   holder.txt_itemTitle = (TextView) convertView.findViewById(R.id.title);
   holder.txt_itemDes = (TextView) convertView.findViewById(R.id.des);
   holder.txt_itemDate = (TextView) convertView.findViewById(R.id.date);
   

   convertView.setTag(holder);
  } else {
   holder = (ViewHolder) convertView.getTag();
  }
  
  holder.txt_itemTitle.setText(itemDetailsrrayList.get(position).getTitle());
  holder.txt_itemDes.setText(itemDetailsrrayList.get(position).getDescription());
  holder.txt_itemDate.setText(itemDetailsrrayList.get(position).getDate());

  return convertView;
 }

 static class ViewHolder {
  TextView txt_itemTitle;
  TextView txt_itemDes;
  TextView txt_itemDate;
 }
}
